<template>
  <div>
    <tb-report
      :columns="columns"
      :apiUrl="apiUrl"
      :tableData="tableData"
      :getData="getData"
    ></tb-report>
  </div>
</template>

<script>
import TbReport from "@/components/tb-report/index.vue";
import {h} from 'vue'

export default {
  name: "App",
  components: { TbReport },
  data() {
    return {
      title: "首页",
      apiUrl:"/scm/api/v1/scmPurchaseStandingBookHead/getPageList",
      columns: [
        {
          title: "序号",
          fixed: 'left', 
          type: "seq",
          width: 60,
          align: "center",
        },
        {
          title: "是否EPC",
          key: "epcFlag",
          field: "epcFlag",
          width: 100,
          align: "center",
        },
        {
          title: "内贸合同号",
          key: "contractNo",
          field: "contractNo",
          width: 100,
          align: "center",
        },
        {
          title: "项目编号",
          key: "programNumber",
          field: "programNumber",
          width: 100,
          align: "center",
        },
        {
          title: "项目名称",
          key: "programName",
          field: "programName",
          width: 100,
          align: "center",
        },
        {
          title: "物资名称",
          key: "materialName",
          field: "materialName",
          width: 100,
          align: "center",
        },
        {
          title: "甲方单位名称",
          key: "purchaseCorp",
          field: "purchaseCorp",
          width: 100,
          align: "center",
        },
        {
          title: "乙方单位名称",
          key: "supplier",
          field: "supplier",
          width: 100,
          align: "center",
        },
        {
          title: "合同交货日期",
          key: "deliveryDate",
          field: "deliveryDate",
          width: 100,
          align: "center",
          slots: {
          default: ({ row }) => {
            return [h('span', { style: { fontSize: '13px' } },123)]
          },
        },
        },
        {
          title: "付款条件",
          key: "paymentCondition",
          field: "paymentCondition",
          width: 100,
          align: "center",
        },
        {
          title: "币制",
          key: "currency",
          field: "currency",
          width: 100,
          align: "center",
        },
        {
          title: "合同总金额",
          key: "contractAmount",
          field: "contractAmount",
          width: 100,
          align: "center",
        },
        {
          title: "已付总金额",
          key: "paidTotalAmount",
          field: "paidTotalAmount",
          width: 100,
          align: "center",
        },
        {
          title: "采购业务员",
          key: "purchaser",
          field: "purchaser",
          width: 100,
          align: "center",
        },
        {
          title: "最新合同价格",
          key: "contractAmount",
          field: "contractAmount",
          width: 100,
          align: "center",
        },
        {
          title: "未付款总额",
          key: "unpaidTotal",
          field: "unpaidTotal",
          width: 100,
          align: "center",
        },
        {
          title: "已付款占比",
          key: "paidProportion",
          field: "paidProportion",
          width: 100,
          align: "center",
        },
        {
          title: "交付地点",
          key: "deliveryPlace",
          field: "deliveryPlace",
          width: 100,
          align: "center",
        },
        {
          title: "质保函开具日期",
          key: "guaranteeLetterDate",
          field: "guaranteeLetterDate",
          width: 100,
          align: "center",
        },
        {
          title: "质保付款日期",
          key: "warrantyPaymentDate",
          field: "warrantyPaymentDate",
          width: 100,
          align: "center",
        },
        {
          title: "资料移交日期",
          key: "dataTransferDate",
          field: "dataTransferDate",
          width: 100,
          align: "center",
        },
        {
          title: "美元兑人民币汇率",
          key: "usdRmbExchangeRate",
          field: "usdRmbExchangeRate",
          width: 100,
          align: "center",
        },
        {
          title: "欧元兑人民币汇率",
          key: "euroRmbExchangeRate",
          field: "euroRmbExchangeRate",
          width: 100,
          align: "center",
        },
        {
          title: "印尼盾兑人民币汇率",
          key: "rupiahRmbExchangeRate",
          field: "rupiahRmbExchangeRate",
          width: 100,
          align: "center",
        },
        {
          title: "备注",
          key: "remark",
          field: "remark",
          width: 100,
          align: "center",
        },

      ],
      tableData:[]
    };
  },
  methods:{
    getData(data){
           if (this.tableData.length == 0) {
            this.tableData = data;
           } else {
            this.tableData = [...this.tableData, ...data];
          }
    }
  }
};
</script>

<style>
</style>
